// 获取用户信息
func (c *MainController) UserInfo() {
    defer c.ServeJSON()
    //还记得我们在路由章节提到的user_id 和order_id吗？
    //在这里我们进行取值
    user_id, _ := c.GetInt("user_id")
    c.Data["json"] = map[string]interface{}{
        "ok": true,
        "data": map[string]interface{}{
            "UserId": user_id,
            "Info":   "获取用户信息"}}
}

//用户注册
func (this *MainController) UserRegister() {
    defer this.ServeJSON()
    //表单中的数据
    username := this.GetString("Username")
    password := this.GetString("Password")

    this.Data["json"] = map[string]interface{}{
        "ok": true,
        "data": map[string]interface{}{
            "data":     "恭喜你注册成功",
            "username": "用户名为:" + username,
            "password": "账号密码为:" + password}}
}



// 获取用户信息
 beego.NSRouter("/user/:user_id([0-9]+)/info", &controllers.MainController{}, "GET:UserInfo"), //注意逗号不要忘记了
// 用户注册的路由
beego.NSRouter("/user/register", &controllers.MainController{}, "POST:UserRegister"),



